#pragma once
#include <atomic>
#include <processthreadsapi.h>
#include "../Utils/PlatTypeUtil.h"

extern uint32 GMainThreadId;
extern uint32 GGameThreadId;
extern uint32 GRenderThreadId;
extern uint32 GRHIThreadId;
extern class ThreadPool* GThreadPool;
extern class VulkanRHI* GVulkanRHI;
extern class ShaderMap* GShaderMap;
extern class RenderState* GRenderState;
extern class GameState* GGameState;

__forceinline bool IsInMainThread()
{
	const uint32 currentThreadId = ::GetCurrentThreadId();
	return currentThreadId == GMainThreadId;
}

__forceinline bool IsInGameThread()
{
	const uint32 currentThreadId = ::GetCurrentThreadId();
	return currentThreadId == GGameThreadId;
}

__forceinline bool IsInRenderThread()
{
	const uint32 currentThreadId = ::GetCurrentThreadId();
	return currentThreadId == GRenderThreadId;
}

__forceinline bool IsInRHIThread()
{
	const uint32 currentThreadId = ::GetCurrentThreadId();
	return currentThreadId == GRHIThreadId;
}

const uint32 GVkFormatSize[] = {
	0U,
	1U,
	2U,
	2U,
	2U,
	2U,
	2U,
	2U,
	2U,
	1U,
	1U,
	1U,
	1U,
	1U,
	1U,
	1U,
	2U,
	2U,
	2U,
	2U,
	2U,
	2U,
	2U,
	3U,
	3U,
	3U,
	3U,
	3U,
	3U,
	3U,
	3U,
	3U,
	3U,
	3U,
	3U,
	3U,
	3U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	2U,
	2U,
	2U,
	2U,
	2U,
	2U,
	2U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	4U,
	6U,
	6U,
	6U,
	6U,
	6U,
	6U,
	6U,
	8U,
	8U,
	8U,
	8U,
	8U,
	8U,
	8U,
	4U,
	4U,
	4U,
	8U,
	8U,
	8U,
	12U,
	12U,
	12U,
	16U,
	16U,
	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